// 实体类导出
export * from './DetectiveCase';
export * from './Evidence';
export * from './Suspect';
export * from './AIAssistant';
export * from './Player';

// 实体类型联合
export type Entity = DetectiveCase | Evidence | Suspect | AIAssistant | Player;

// 实体ID类型
export type EntityId = string;

// 实体类型枚举
export enum EntityType {
  CASE = 'case',
  EVIDENCE = 'evidence',
  SUSPECT = 'suspect',
  AI_ASSISTANT = 'ai_assistant',
  PLAYER = 'player'
}

/**
 * 获取实体类型
 */
export function getEntityType(entity: Entity): EntityType {
  if ('category' in entity) return EntityType.CASE;
  if ('type' in entity && 'importance' in entity) return EntityType.EVIDENCE;
  if ('status' in entity && 'role' in entity) return EntityType.SUSPECT;
  if ('config' in entity && 'stats' in entity) return EntityType.AI_ASSISTANT;
  if ('username' in entity && 'stats' in entity) return EntityType.PLAYER;
  throw new Error('Unknown entity type');
}

/**
 * 获取实体显示名称
 */
export function getEntityDisplayName(entity: Entity): string {
  if ('title' in entity) return entity.title;
  if ('name' in entity) return entity.name;
  if ('nickname' in entity) return entity.nickname;
  if ('username' in entity) return entity.username;
  return 'Unknown';
}